package dujiu.luogu.circulation;

import java.util.*;

public class P5726 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<Integer> list = new ArrayList<>();
        int[] arr = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
            list.add(arr[i]);
            sum += arr[i];
        }
        int max = Collections.max(list);
        int min = Collections.min(list);
        double average = (sum - max - min) *1.0 / (n-2);
        System.out.printf("%.2f",average );
    }
}
